<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/

//if ( !is_superadmin() && !check_purview('manage_link') ) prompt('对不起，你没有权限执行本操作！');
//初始化信息，进入表单页面
empty($do) && $do = 'list';
if ($do == 'list') {
	$user = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid and a.id = '$_USER->id'");
	//$purview = unserialize($usergroup['flag']);
	include_once('template/useredit.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$id = getGP('id','P','int');
	$username = getGP('username','P');
	$departmentid = getGP('departmentid','P');
	$name = getGP('name','P');
	$sex = getGP('sex','P');
	$tel = getGP('tel','P');
	$phone = getGP('phone','P');
	$city = getGP('city','P');
	$fax = getGP('fax','P');
	$email = getGP('email','P');
	$birthdate = getGP('birthdate','P');
	$position = getGP('position','P');
	$groupid = getGP('groupid','P');
	$user_view = array(
		'name' => $name,
		'sex' => $sex,
		'tel' => $tel,
		'phone' => $phone,
		'city' => $city,
		'birthdate' => $birthdate,
		'email' => $email,
		'fax' => $fax,
		'position' => $position
	);
	update_db('user_view',$user_view, array('uid' => $id));
	//echo $fatherid;
	//exit;
	goto_page('admin.php?ac=useredit&fileurl=user&message=1');
	

}

?>